package common;

public class Result<T> {
    private int code;
    private String msg;
    private T data;

    // 添加缺失的构造器
    public Result(int code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static Result<Void> ok() {
        return new Result<>(200, "success", null);
    }

    public static Result<Void> error(int code, String msg) {
        return new Result<>(code, msg, null);
    }

    public Result<T> data(T data) {
        this.data = data;
        return this;
    }

    // 添加缺失的getter方法（JSON序列化需要）
    public int getCode() { return code; }
    public String getMsg() { return msg; }
    public T getData() { return data; }
}
